<?php

include("header.php");

	print("
		<title>DoD Block Exploits - Full Detection List</title>

		<table align=\"center\" cellpadding=\"4\" cellspacing=\"0\" rules=\"rows\">
		<tr height=\"25px\">
		<td align=\"center\" style=\"background: #20578d\">Time</td>
		<td align=\"center\" style=\"background: #20578d\">Name</td>
		<td align=\"center\" style=\"background: #20578d\">Steam ID</td>
		<td align=\"center\" style=\"background: #20578d\">Exploit</td>
		</tr>
		");

	$plrData = array();

	$list = $_GET["list"];
	$server_ip = $_GET["ip"];
	
	if($list == "all")
		$detection_name = "ALL";
	else if($list == "idpending")
		$detection_name = "Steam ID Pending";
	else if($list == "setinfo")
		$detection_name = "Setinfo Trace";
	else if($list == "speckill")
		$detection_name = "Spectator Killing";
	else if($list == "whitemodel")
		$detection_name = "White Player Model";
	else if($list == "mgreload")
		$detection_name = "Undeployed MG-Reload";
	else if($list == "respawn")
		$detection_name = "Respawn Timer Bypass";
	else if($list == "classlimit")
		$detection_name = "Class Limit Bypass / White Model";
	else if($list == "voicechat")
		$detection_name = "Voice Chat Name Spoofing";
		
	if(strlen($server_ip) > 0)
		{
		if($list == "setinfo")
			$query = "select id,player_steam,player_ip,player_name,exploit_name,exploit_action,time from ".$tbl_logged." WHERE exploit_name LIKE '".$detection_name." %' AND (server_ip='".$server_ip."') order by id desc";
		else if($list == "all")
			$query = "select id,player_steam,player_ip,player_name,exploit_name,exploit_action,time from ".$tbl_logged." WHERE (server_ip='".$server_ip."') order by id desc";
		else
			$query = "select id,player_steam,player_ip,player_name,exploit_name,exploit_action,time from ".$tbl_logged." WHERE (exploit_name='".$detection_name."') AND (server_ip='".$server_ip."') order by id desc";
		}
	else
		{
		if($list == "setinfo")
			$query = "select id,player_steam,player_ip,player_name,exploit_name,exploit_action,time from ".$tbl_logged." WHERE exploit_name LIKE '".$detection_name."%' order by id desc";
		else if($list == "all")
			$query = "select id,player_steam,player_ip,player_name,exploit_name,exploit_action,time from ".$tbl_logged." order by id desc";
		else
			$query = "select id,player_steam,player_ip,player_name,exploit_name,exploit_action,time from ".$tbl_logged." WHERE (exploit_name='".$detection_name."') order by id desc";
		}
				


	$result = mysql_query($query);

	if($result)
		$num_results = mysql_num_rows($result);
	else
		$num_results = 0;

	if($num_results<1)
		{
		print("
			<tr class=\"row0\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row0'\">
			<td colspan=\"4\" class=\"customtd1\" align=\"center\">No Detections Logged</td>
			</tr>
		</tr>");
		}
	else
		{
		for($i=0;$row = mysql_fetch_array($result);$i++)
			{
			for($j=0;$j<7;$j++)
					$plrData[$i][$j] = $row[$j];
			}
        
		$rowclass = 0;
		for($i=0;$plrData[$i][0]!=null;$i++)
			{
			$diff=$time_diff * 3600;
			$logtime=date("m-d-Y",strtotime($plrData[$i][6]) + $diff);

			print("
			<tr class=\"row".$rowclass."\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row".$rowclass."'\" onClick=\"document.location='view_details.php?id=".$plrData[$i][0]."'\">
				<td class=\"customtd1\" align=\"center\">".$logtime."</td>
				<td class=\"customtd1\" align=\"center\">".$plrData[$i][3]."</td>
				<td class=\"customtd1\" align=\"center\">".$plrData[$i][1]."</td>
				<td class=\"customtd1\" align=\"center\">".$plrData[$i][4]."</td>
			 </tr>");
			 
			 $rowclass = 1 - $rowclass;	 
			}
		}
	
	echo "<tr><td align=\"center\" colspan=\"4\" height=\"25px\" style=\"background: #20578d\">";
	
	if(strlen($server_ip) > 0)
		{
		if($list == "setinfo")
			$query = "SELECT COUNT(id) AS 'total' FROM ".$tbl_logged." WHERE (exploit_name LIKE '".$detection_name." %') AND (server_ip='".$server_ip."')";
		else if($list == "all")
			$query = "SELECT COUNT(id) AS 'total' FROM ".$tbl_logged." WHERE (server_ip='".$server_ip."')";
		else
			$query = "SELECT COUNT(id) AS 'total' FROM ".$tbl_logged." WHERE (exploit_name='".$detection_name."') AND (server_ip='".$server_ip."')";
		}
	else
		{
		if($list == "setinfo")
			$query = "SELECT COUNT(id) AS 'total' FROM ".$tbl_logged." WHERE (exploit_name LIKE '".$detection_name." %')";
		else if($list == "all")
			$query = "SELECT COUNT(id) AS 'total' FROM ".$tbl_logged."";
		else
			$query = "SELECT COUNT(id) AS 'total' FROM ".$tbl_logged." WHERE (exploit_name='".$detection_name."')";
		}
		
	$result = mysql_query($query);
		
	if($result)
		$detectCount = mysql_fetch_array($result);
	else
		$detectCount['total'] = 0;
		
	if(strlen($server_ip) > 0)
		echo "* displaying ".$detectCount['total']." '".$detection_name."' logged detections from '".$server_ip."' *";
	else
		echo "* displaying ".$detectCount['total']." '".$detection_name."' logged detections from ALL servers *";
		
	echo "</td></tr>";

include("footer.php");

?>